package com.yjh.pojo.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {
    @TableId(type = IdType.AUTO) // 自增主键
    private Integer userId;

    @TableField("phone") // 对应数据库字段名
    private String phone;

    @TableField("username")
    private String username;

    @TableField("realname")
    private String realname;

    @TableField("avatar")
    private String avatar;

    @TableField("password")
    private String password;

    @TableField("role")
    private Integer role; // 0=普通用户，1=管理员

    @TableField("state")
    private Integer state;

    @TableField("forbidden_end_time")
    private LocalDateTime forbiddenEndTime;

    @TableField(value = "create_time", fill = FieldFill.INSERT) // 插入时自动填充
    private LocalDateTime createTime;

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) // 插入/更新时自动填充
    private LocalDateTime updateTime;
}
